package com.zenithmind.disk.service;

import com.zenithmind.disk.pojo.domain.Files;
import com.zenithmind.disk.pojo.dto.FileDTO;
import com.zenithmind.disk.pojo.query.FileQuery;
import com.zenithmind.disk.pojo.vo.FileVO;
import com.zenithmind.common.result.PageResult;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * 文件操作组合服务接口
 * 遵循依赖倒置原则：为Controller层提供统一的文件操作接口
 * 遵循单一职责原则：专注于协调各个专门的服务
 */
public interface FileOperationService {

    // 基本文件操作
    FileVO uploadFile(MultipartFile file, String userId, String parentId);
    FileVO createFolder(FileDTO fileDTO);
    List<FileVO> listFiles(String userId, String parentId);
    FileVO renameFile(FileDTO fileDTO);
    boolean moveFile(String fileId, String targetId, String userId);

    // 文件管理操作
    boolean deleteFile(String fileId, String userId);
    FileVO getFileInfo(String fileId);
    PageResult<FileVO> filePage(FileQuery fileQuery);
    boolean deleteBatchFiles(List<String> ids);
    FileVO addOrUpdateFileByAdmin(Files file);

    // 文件下载操作
    void downloadFile(String fileId, String userId, HttpServletResponse response) throws IOException;
    void downloadDirectory(String folderId, HttpServletResponse response) throws IOException;
    String getFilePath(String fileId, String userId);
}
